#include "stdafx.h"

#ifdef _DEBUG

#include "rxdebug.h"

#ifndef _WINBASE_

extern "C" void _stdcall OutputDebugStringA( const char* lpOutputString );

extern "C" void _stdcall OutputDebugStringW( const unsigned short* lpOutputString );

#ifdef UNICODE
#define OutputDebugString  OutputDebugStringW
#else
#define OutputDebugString  OutputDebugStringA
#endif // !UNICODE

#endif //_WINBASE

#ifdef _countof
#undef _countof
#define _countof(array) (sizeof(array)/sizeof(array[0]))
#endif

inline void _cdecl RxTrace(const TCHAR* lpszFormat, ...)
{
	va_list args;
	va_start(args, lpszFormat);
	int nBuf;
	TCHAR szBuffer[512];
	nBuf = _vsntprintf(szBuffer, _countof(szBuffer), lpszFormat, args);
	RXASSERT(nBuf >= 0);
    ::OutputDebugString(szBuffer);
	va_end(args);
}

#endif //_DEBUG, entire file
